package cn.agiledata.security.db.bean;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import cn.agiledata.bank.common.util.Constant;
import cn.agiledata.bank.common.util.ConvertUtil;
import cn.agiledata.bank.common.util.DateUtil;

public class EnctBean implements Constant {
	protected List needEnctList = new ArrayList();	//需要加密的字段List
	
	public List getNeedEnctList() {
		return needEnctList;
	}

	public void setNeedEnctList(List needEnctList) {
		this.needEnctList = needEnctList;
	}
	
	/**
	 * 添加needEnctList元素--list类型
	 * @param list
	 * @return
	 */
	public boolean addNeedEnctList(List list) {
		return needEnctList.addAll(list);
	}
	
	/**
	 * 添加needEnctList元素--对象类型
	 * @param object
	 * @return
	 */
	public boolean addNeedEnctList(Object object) {
		String str = "";
		if(object == null) { //如果是空,返回"null"
			str = NULL;
		}else if(object instanceof Long || object instanceof Double) {
			str = ConvertUtil.parseDec(object,NUMBER_FORMAT);
		}else if(object instanceof Date) {
			str = DateUtil.date2String((Date)object,DATE_FORMAT);
		} else if(object instanceof String){
			str = (String)object;
		}
		return needEnctList.add(str);
	}	
	
	
}
